package com.mf.controller;

import com.mf.entity.Workday;
import com.mf.service.IWorkdayService;
import com.mf.utils.Result;
import com.mf.vo.WorkdayVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 工作日 前端控制器
 * </p>
 *
 * @author mf
 * @since 2024-05-20
 */
@RestController
@RequestMapping("/stock/workday")
@Tag(name="工作日")
public class WorkdayController {
    @Resource
    private IWorkdayService workdayService;

    @Operation(summary = "查询范围内工作日")
    @GetMapping("findWorkDayByScope")
    public Result<List<Workday>> findWorkDayByScope(@RequestParam("start") String start, @RequestParam("end") String end) {
        return Result.success(workdayService.findWorkDayByScope(start, end));
    }

    @Operation(summary = "批量新增工作日")
    @PostMapping("addWorkday")
    public Result<Boolean> addWorkday(@RequestBody WorkdayVo workdayVo) {
        return Result.success(workdayService.addWorkday(workdayVo.getWorkdayList()));
    }

}
